﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using MvcBlog.Common.Models;

namespace MvcBlog
{
    public class Permissions
    {
        public static bool Allowed(string username, int allowedRole)
        {
            User user = CacheController.getUser(username);

            //berechtigungen prüfen
            if (user != null && user.Role.Role_ID == allowedRole)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        public static bool Allowed(string username)
        {
            User user = CacheController.getUser(username);

            //berechtigungen prüfen
            if (user != null)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}